package com.shiyang.decorator;

import com.shiyang.decorator.mycoffee.Drink;
import com.shiyang.decorator.mycoffee.LongBlack;
import com.shiyang.decorator.mydecorator.Chocolate;
import com.shiyang.decorator.mydecorator.Milk;

/**
 * @author shiyang date: 2020/9/11
 */
public class CoffeeBar {
    public static void main(String[] args) {
        // 装饰者模式下的订单 : 2份巧克力 + 1份牛奶的LongBlack
        // 1. 点一份LongBlack
        Drink order = new LongBlack();
        System.out.println("费用1 - " + order.getDes() + " - " + order.cost());

        // 2. order 加入一份牛奶
        order = new Milk(order);
        System.out.println("费用2 - " + order.getDes() + " - " + order.cost());

        // 3. order 加入一份巧克力
        order = new Chocolate(order);
        System.out.println("费用3 - " + order.getDes() + " - " + order.cost());

        // 4. order 加入一份巧克力
        order = new Chocolate(order);
        System.out.println("费用3 - " + order.getDes() + " - " + order.cost());
    }
}
